home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CWeaponGunM1A1.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  3.3 KB  |  129 lines

  1. package Local.Game.Thing
  2. {
  3.    import Local.Game.World.*;
  4.    import Local.Game.World.Map.*;
  5.    import Local.Game.World.Map.Cell.*;
  6.    import Local.Math.*;
  7.    import STC9.System.*;
  8.    import flash.display.*;
  9.    import flash.events.*;
  10.    import flash.geom.*;
  11.    
  12.    public class CWeaponGunM1A1 extends CWeapon
  13.    {
  14.       
  15.       public static var _Upgrades:Array = [{
  16.          "mName":"",
  17.          "mAmmo":INFINATEAMMO,
  18.          "mAutoFire":true,
  19.          "mFireRate":SECONDS * 2,
  20.          "mDamage":100,
  21.          "mRange":INFINATERANGE
  22.       }];
  23.        
  24.       
  25.       public function CWeaponGunM1A1()
  26.       {
  27.          super();
  28.          ┬º┬ºpush(┬º┬ºfindproperty(mAngleRange));
  29.          ┬º┬ºpush("min");
  30.          ┬º┬ºpush(-40 * 256 / 360);
  31.          ┬º┬ºpush("max");
  32.          ┬º┬ºpush(5 * 256);
  33.          if(true)
  34.          {
  35.             ┬º┬ºpush(┬º┬ºpop() / 360);
  36.          }
  37.          ┬º┬ºpop().mAngleRange = null;
  38.          mTargetAngle = new CAngle();
  39.          mUpgrade = 0;
  40.          mType = "gunm1a1";
  41.          Process = Process_Normal;
  42.          AddAnimation("stand",TankM1A1_Gun,"AddSprite_Black");
  43.          mAngle.mAngle256 = mAngleRange.min * 0.25;
  44.          mTargetAngle.mAngle256 = mAngle.mAngle256;
  45.          AddSound("fire",Tank_Maingun);
  46.       }
  47.       
  48.       override public function Fire() : void
  49.       {
  50.          AddThing(new CShotTankShell(GetShotPosition("gun"),mAngle.Clone()));
  51.          PlaySound("fire");
  52.          IncrementFired();
  53.       }
  54.       
  55.       public function SetTarget(param1:CThingMain) : Boolean
  56.       {
  57.          if(param1.mPosition.x - mPosition.x > 100)
  58.          {
  59.             mCurrentTarget = param1;
  60.             return true;
  61.          }
  62.          mCurrentTarget = null;
  63.          return false;
  64.       }
  65.       
  66.       public function GetShotPosition(param1:String) : CPosition
  67.       {
  68.          return GetObjectPosition(param1,mPosition);
  69.       }
  70.       
  71.       override public function get mWeaponName() : String
  72.       {
  73.          return "gunm1a1";
  74.       }
  75.       
  76.       override public function Draw() : void
  77.       {
  78.          if(true)
  79.          {
  80.             super.Draw();
  81.             DrawSprite(GetOrientationMatrix());
  82.          }
  83.       }
  84.       
  85.       public function Process_Normal() : void
  86.       {
  87.          var _loc1_:CAngle = null;
  88.          var _loc2_:CPosition = null;
  89.          if(true)
  90.          {
  91.             if(mCurrentTarget)
  92.             {
  93.                _loc2_ = CPosition.SUBTRACT(mCurrentTarget.mCollide.mMid,mPosition);
  94.                if(true)
  95.                {
  96.                   if(_loc2_.x < 0)
  97.                   {
  98.                      if(true)
  99.                      {
  100.                         _loc2_.SetXY(-_loc2_.x,-_loc2_.y);
  101.                      }
  102.                   }
  103.                   mTargetAngle.mDelta = _loc2_;
  104.                }
  105.             }
  106.             else
  107.             {
  108.                mTargetAngle.mAngle256 = mParent.mAngle.mAngle256;
  109.             }
  110.          }
  111.          _loc1_ = new CAngle(mTargetAngle.mAngle - mAngle.mAngle);
  112.          if(true)
  113.          {
  114.             mAngle.mAngle += _loc1_.mAngle * 0.5;
  115.             if(true)
  116.             {
  117.                WeaponUpdate();
  118.             }
  119.             Process_Children();
  120.          }
  121.       }
  122.       
  123.       override public function get mUpgrades() : Array
  124.       {
  125.          return _Upgrades;
  126.       }
  127.    }
  128. }
  129.